<div id="form-msg"></div>
<form action="javascript:add_member_key()" id="add_member_key" method="post" class="modal hide form-horizontal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
  <input type="hidden" id="form-add-member-key-input-member-uuid" value="<?=$user['uuid']?>" name="member_uuid">
  <input type="hidden" id="form-input-uuid" name="uuid">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="hideModal('add_member_key');">×</button>
    <h4 id="myModalLabel">Add key</h4>
  </div>
  <div class="modal-body">
	<div id="form-error"></div>
	<div class="form-controls">
		<div class="control-group">
			<label class="control-label-left" for="form-add-member_key-input-title">Category</label>
			<div class="controls">
				<select id="form-add-member_key-input-category"  name="flt_blocked">
					<?=Html_Form::makeOptions($categories,'',' no category '); ?>
				</select>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label-left" for="form-add-member_key-input-title">Title</label>
			<div class="controls">
				<input type="text" id="form-add-member_key-input-title"  name="title">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label-left" for="form-add-member-key-input-protocol">Protocol</label>
			<div class="controls">
				<input type="text" id="form-add-member-key-input-protocol" name="protocol">
			</div>
		</div>		
		<div class="control-group">
			<label class="control-label-left" for="form-add-member-key-input-host">Host (ip/domen)</label>
			<div class="controls">
				<input type="text" id="form-add-member-key-input-host" name="host">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label-left" for="form-add-member-key-input-port">Port</label>
			<div class="controls">
				<input type="text" id="form-add-member-key-input-port" name="port">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label-left" for="form-add-member-key-input-login">Login</label>
			<div class="controls">
				<input type="text" id="form-add-member-key-input-login" name="login">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label-left" for="form-add-member-input-password">Password</label>
			<div class="controls">
				<input type="text" id="form-add-member-input-password" name="password">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label-left" for="form-add-member-input-comment">Comment</label>
			<div class="controls">
				<textarea style = "resize: none;" id="form-add-member-input-comment" name="comment"></textarea>
			</div>
		</div>
	</div>
  </div>
  <div class="modal-footer">
	<input class="btn" type="reset" value="Close" data-dismiss="modal" aria-hidden="true" onclick="hideModal('add_member_key');">
	<input class="btn btn-primary" type="submit" value="Save">
  </div>
</form>
<div class="row">
	<div class="span12">
		<div class="bookmark-title">
			<h4><a href="/admin/?mod=member">Members</a> → <span class="normal">Keys for</span> <?=$user['login_key'];?></h4>
			<hr>
		</div>
	</div>
	<form action="<?=$currentUrl;?>" method="POST" name="member_keys_list">
		<input type="hidden" name="filter_<?php echo $fltInfo['__name__']; ?>" value="on"/>
		<div class="span5">
			<div class="btn-group">
				<label for="btn_delete"  class="btn btn-small">Delete</label>
			</div>
			<input id="btn_delete"  class="hide" type="submit" name="act" value="Delete"  onclick="return isCheck(1);">
			
			<div class="btn-group">
				<a id="btn_add_member_key" href="javascript:void(0)" role="button" class="btn btn-small btn-primary" data-toggle="modal"><i class="icon-plus icon-white"></i>&nbsp; Add member key</a>
			</div>
		</div>
		<div class="span4 pagination pagination-small">
			<?php include('tpl/bootstrap_pager.php')?>
		</div>
		<div class="span3 button-filter text-right">
			<label for="btn_reset_filter" class="btn btn-small">Reset Filter</label>
			<label for="btn_filter" class="btn btn-small">Filter</label>
			<input id="btn_reset_filter" class="hide" type="submit" name="filter_reset" value="Reset Filter">
			<input id="btn_filter" class="hide" type="submit" name="filter_set"   value="Filter">
		</div>
		<div class="span12">
			<table class="table table-bordered table-condensed table-hover">
				<col style="width:25px;">
				<col style="width:350px;">
				<col style="width:90px;">
				<col>
				<col style="width:90px;">
				<col style="width:100px;">
				<col style="width:150px;">
				<col style="width:65px;">
				<thead>
					<tr class="tr-sorter">
						<th>&nbsp;</th>
						<th class="text-center">Title</th>
						<th class="text-center">Protocol</th>
						<th class="text-center">Host</th>
						<th class="text-center">Port</th>
						<th class="text-center">Login</th>
						<?php Sorter::show($srtInfo['category_title'],'Category')?>
						<th class="text-center">Action</th>
					</tr>
				</thead>
				<tr class="info table-filter-tr">
					<td><input name="all" type="checkbox" onclick="selectAll('uuid[]', this.checked,'member_keys_list')"></td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>
						<select class="input-small" name="flt_category_id" style="width:130px;">
								<?=Html_Form::makeOptions($categories,$fltInfo['category_id'],' '); ?>
						</select>
					</td>
					<td>&nbsp;</td>
				</tr>
				<?php foreach($rows as $r):?>
					<tr id="<?=$r['id'];?>" class="<?=$r['class']?>">
						<td><input name="uuid[]" value="<?=$r['id'];?>" class="uuid_check" type="checkbox" ></td>
						<td class="title"><?=$r['param_1']?></td>
						<td class="protocol"><?=$r['param_2']?></td>
						<td class='host'><?=$r['param_3']?></td>
						<td class='port'><?=$r['param_4']?></td>
						<td class='login'><?=$r['param_5']?></td>
						<td class='category'><?=$r['category_title']?></td>
						<td class="text-center">
							<div class="btn-group">
								<button type="button" onclick="editKey('<?=$r['id'];?>','<?=$user['uuid']?>')" class="btn btn-mini id-edit"><i class="icon-pencil"></i></button>
								<button type="button" class="id-delete btn btn-mini" onclick="deleteKey('<?=$r['id'];?>');"><i class="icon-trash"></i></button>
							</div>
						</td>
					</tr>
				<?php endforeach;?>
				<?php if(count($rows)==1):?>
				<tr id="no_result">
					<td colspan="8">
						<?='No results match your search...';?>
					</td>
				</tr>
				<?php endif; ?>
			</table>
		</div>
	</form>
</div>